<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
    <title>注册</title>
    <link rel="icon" href="favicon.ico" type="image/ico">
    <meta name="author" content="yinqi">
    <link href="/static/admin/css/bootstrap.min.css" rel="stylesheet">
    <link href="/static/admin/css/materialdesignicons.min.css" rel="stylesheet">
    <link href="/static/admin/css/style.min.css" rel="stylesheet">
    <link href="/static/admin/css/reg.css" rel="stylesheet">
    <script type="text/javascript" src="/static/admin/js/jquery.min.js"></script>
    <script type="text/javascript" src="/static/admin/js/bootstrap.min.js"></script>
    <script src="/static/admin/js/bootstrap-notify.min.js"></script>
    <script type="text/javascript" src="/static/admin/js/lightyear.js"></script>
</head>

<body>
<div class="row lyear-wrapper" style="background-image: url(/static/admin/images/login-bg-3.jpg); background-size: cover;">
    <div class="lyear-login">
        <div class="login-center">
            <div class="login-header text-center">
                <a href="index.html"> <img alt="light year admin" src="/static/admin/images/logo-sidebar.png"> </a>
            </div>
            <form action="#!" method="post">
                <div class="form-group has-feedback feedback-left">
                    <input type="text" placeholder="请输入您的用户名" class="form-control" name="username" id="username" />
                    <span class="mdi mdi-account form-control-feedback" aria-hidden="true"></span>
                </div>
                <div class="form-group has-feedback feedback-left">
                    <input type="password" placeholder="请输入密码" class="form-control" id="password" name="password" />
                    <span class="mdi mdi-lock form-control-feedback" aria-hidden="true"></span>
                </div>
                <div class="form-group has-feedback feedback-left row">
                    <div class="col-xs-7">
                        <input type="text" name="captcha" id="captcha" class="form-control" placeholder="验证码">
                        <span class="mdi mdi-check-all form-control-feedback" aria-hidden="true"></span>
                    </div>
                    <div class="col-xs-5">
<#--                        <img src="/static/admin/images/captcha.png" class="pull-right" id="captcha" style="cursor: pointer;" onclick="this.src='/admin/shopAdmin/getValidateCode'+'?d='+Math.random();" title="点击刷新" alt="captcha">-->
                        <img src="/admin/shopAdmin/getValidateCode" class="pull-right" id="captchas" style="cursor: pointer;"
                             onclick="changeCode()" title="点击刷新">
                    </div>
                </div>
                <div class="form-group">
<#--                    <label class="lyear-checkbox checkbox-primary m-t-10">-->
<#--                        <input type="checkbox"><span>5天内自动登录</span>-->
<#--                    </label>-->
                    <label class="lyear-checkbox checkbox-primary right m-t-10">
                        <a href="/admin/shopAdmin/login">去登录</a>
                    </label>
                </div>
                <div class="form-group">
                    <button class="btn btn-block btn-primary" id="duSub" type="button">立即注册</button>
                </div>
            </form>
            <hr>
            <footer class="col-sm-12 text-center">
                <p class="m-b-0">Copyright © 2019 <a href="">151615618981</a>. All right reserved</p>
            </footer>
        </div>
    </div>
</div>
<script>
    $("#duSub").click(function () {
        $.ajax({
            type: "post",
            url: "/admin/shopAdmin/doReg",
            dataType: "json",
            data:{
                adminName: $("#username").val(),
                adminPass: $("#password").val(),
                captcha: $("#captcha").val()
            },
            success: function (res) {
                if (res.status === 200){
                    lightyear.notify(res.data, 'success', 2000, 'mdi mdi-emoticon-happy', 'top', 'center' , '/admin/shopAdmin/login');
                }else{
                    lightyear.notify(res.data,'danger',2000);
                }
            }
        })
    });

    //切换验证码
    function changeCode() {
        $('#captchas').attr('src','/admin/shopAdmin/getValidateCode?d='+Math.random());
    }
</script>
</body>
</html>